using System;
using System.Reflection;
using TestMonkey.Models;

namespace TestMonkey.TestRunners
{
	public class MSTest : TestRunner
	{
		public override CodeString TestClassAttribute
		{
			get { return "[TestClass]" + Environment.NewLine + GeneratedCodeAttribute; }
		}

		public override CodeString TestAttribute
		{
			get { return String.Format(@"[TestMethod, GeneratedCode(""TestMonkey"", ""{0}"")]", Assembly.GetExecutingAssembly().GetName().Version); }
		}

		public override CodeString ManualTestAttribute
		{
			get { return @"[TestMethod]"; }
		}

		public override CodeString AreEqual(string expected, string actual)
		{
			return String.Format("Assert.AreEqual({0}, {1});", expected, actual);
		}

		public override CodeString AreEqual(string expected, string actual, string message)
		{
			return String.Format("Assert.AreEqual({0}, {1}, {2});", expected, actual, message);
		}

		public override CodeString Imports
		{
			get { return "using Microsoft.VisualStudio.TestTools.UnitTesting;" + Environment.NewLine + "using System.CodeDom.Compiler;"; }
		}

		public override CodeString Inconclusive(string message)
		{
			return string.Format("Assert.Inconclusive({0});", message);
		}

		public override CodeString Fail(string message)
		{
			return string.Format("Assert.Fail({0});", message);
		}

		public override CodeString IsTrue(string actual)
		{
			return string.Format("Assert.IsTrue({0});", actual);
		}

		public override CodeString IsFalse(string actual)
		{
			return string.Format("Assert.IsFalse({0});", actual);
		}

		public override CodeString IsNull(string actual)
		{
			return string.Format("Assert.IsNull({0});", actual);
		}

		public override CodeString IsTrue(string actual, string message)
		{
			return string.Format("Assert.IsTrue({0}, {1});", actual, message);
		}

		public override CodeString IsFalse(string actual, string message)
		{
			return string.Format("Assert.IsFalse({0}, {1});", actual, message);
		}

		public override CodeString IsNull(string actual, string message)
		{
			return string.Format("Assert.IsNull({0}, {1});", actual, message);
		}
	}
}